<?php
/**	
*	FILENAME: 		/server_app/newswire_section_stories.php
*	DESCRIPTION:	This backend script produces a JSON response representing a list story titles and IDs given a section name of the current newswire.
*	AUTHOR:			Casey Burkhardt
*	VERSION:		1.0.0
*	LAST MODIFIED:	1/6/2009
**/

require_once($_SERVER['DOCUMENT_ROOT'] . "/libraries/newswire.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/libraries/functions.php");

enforceSSL();

$sectionName = $_POST["section"];

// Obtain the issue and section information
$timeStamp = getNewswireTimestamp();
$storyData = getStoryData($sectionName);

// Check the returned results for validity.
if ($timeStamp === FALSE || $storyData === FALSE) {
	$response["response_type"] = "error";
	$response["error_desc"] = "Unable to obtain Wildcat Newswire information.";
	echo(json_encode($response));
	die();
} else {
	$response["response_type"] = "success";
	$response["issue_timestamp"] = $timeStamp;
	$response["story_data"] = $storyData;
	echo(json_encode($response));
	die();	
}
?>